﻿using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;

namespace Location.API.Model
{
    public class UserLocation
    {
        [BsonIgnoreIfDefault]
        [BsonRepresentation(BsonType.ObjectId)]
        public string Id { get; set; }
        /// <summary>
        /// 用户Id
        /// </summary>
        public string UserId { get; set; }
        /// <summary>
        /// 位置Id
        /// </summary>
        [BsonRepresentation(BsonType.ObjectId)]
        public string LocationId { get; set; }
        /// <summary>
        /// 是否默认
        /// </summary>
        public bool IsDefault { get; set; }

        public UserLocation(string userId,string locationId)
        {
            this.UserId = userId;
            this.LocationId = locationId;
            this.IsDefault = false;
        }
        public void SetDefault()
        {
            this.IsDefault = true;
        }
    }
}
